<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:set var="pageTitle" value="外协单单据跟踪" />
<%@ include file="../inc/Title.jsp"%>
<head>
<link rel="stylesheet" type="text/css" href="/css/base.css" />
<script src="/js/popup_ext.js"></script>
<script language="javascript">
	function doCopy(code){
		if(checkNavigator()[0]=="msie"){
			window.clipboardData.setData("Text",code);
			ShowAlert('提示框','复制成功！',200,100);
		}else{
			ShowAlert('提示框','对不起，当前浏览器不支持剪帖板功能！',200,100);
		}
	}
	function showBus(bbItemId){
		showWin(900,600,"/business/BusinessBillPrint.ihtm?id="+bbItemId+"&type=ITEM_SIMPLE");
	}
	function showGatherBill(id){
		var url="/cooper/GatherBillEdit.ihtm?id="+id+"&alert_type=FORM";
		showWin(1024,600,url);
	}
	function showPayBill(id){
		var url="/finance/PayBillEdit.ihtm?id="+id+"&alert_type=FORM";
		showWin(1024,600,url);
	}
	function showAdjustBill(id){
		var url="/finance/AdjustBillEdit.ihtm?id="+id+"&alert_type=FORM";
		showWin(1024,600,url);
	}
	function doInit(){
		if(window.screen.availWidth>900){
			var w=window.screen.availWidth*0.98;
			window.resizeTo(w,600);
			document.getElementById("mainDiv").style.width=(w-60)+"px";
			//居中
			var resizeWinTop=(window.screen.availHeight-600)/2;
			var resizeWinLeft=(window.screen.availWidth-w)/2;
			window.moveTo(resizeWinLeft,resizeWinTop);
		}
	}
	function doEdit(){
		var url="/cooper/CooperBillEdit.ihtm?edit_type=MODIFY&id=${id}&alert_type=FORM";
		showWin(1024,600,url);
	}
	function doDownload(fileName,sourceName){
		window.location="/FileDownload.ihtm?file_name="+encodeURIComponent(fileName)+"&source_name="+encodeURIComponent(sourceName);
	}
</script>
</head>
<body oncontextmenu="return false" class="sheet" onLoad="doInit();">
<div class="sheet-main" style="width:860px" id="mainDiv">
  <div class="sheet-top">
    <div class="content">
      <h2>${code}单据跟踪<c:if test="${currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';COOP_MODI;')!=-1}">&nbsp;&nbsp;<span style="font-size:14px"><a href="javascript:doEdit();">修改外协单</a></span></c:if></h2>
      <p>与外协单相关的单据，包括收货、付款、调账等</p>
    </div>
  </div>
  <div class="sheet-list">
    <div class="search-business">
    <div class="table-list">
     	<fieldset class="det_fieldset ">
     	<legend class="mag10">附件</legend>
        <table width="98%" align="center">
           	<tr>
			   	<th  width="22%">文件</th>
				<th  width="22%">资料路径</th>
				<th  width="24%">文件说明</th>
				<th  width="10%">上传人</th>
				<th  width="14%">上传时间</th>
				<th  width="8%">操作</th>
			</tr>
			<c:if test="${fn:length(accList)==0}">
			<tr>
				<td colspan="6">没有附件</td>
			</tr>
			</c:if>
			<c:if test="${fn:length(accList)>0}">
			<c:forEach var="item" items="${accList}" varStatus="i">
				<tr>
					<td >
						<c:if test="${item.fileName!=null && item.fileName!=''}"><a href="${item.fileName}" target="_blank">${item.sourceName}</a></c:if>
						<c:if test="${item.fileName==null || item.fileName==''}">${item.sourceName}</c:if>
					</td>
					<td >${item.customPath}</td>
					<td >${item.mark}</td>
					<td >${item.createrName}</td>
					<td ><fmt:formatDate value="${item.createTime}" pattern="yyyy-MM-dd HH:mm"/></td>
					<td>
						<c:if test="${item.fileName!=null && item.fileName!=''}"><a href="javascript:doDownload('${item.fileName}','${item.sourceName}');">下载</a></c:if>
						<c:if test="${item.fileName==null || item.fileName==''}">下载</c:if>
					</td>
				</tr>
			</c:forEach>
			</c:if>
		</table>
		</fieldset>
     </div>
     <div class="blank12"></div>
    
    <div class="table-list">
     	<fieldset class="det_fieldset ">
     	<legend class="mag10">项目明细</legend>
        <table width="98%" align="center">
           	<tr>
			   	<th width="12%" >项目类型</th>
			   	<th width="16%" >内容</th>
				<th width="14%" >材质</th>
				<th width="14%" >规格</th>
				<th width="6%" >单位</th>
				<th width="8%" >数量</th>
				<th width="18%" >制作要求</th>
				<th width="12%" >来源单号</th>
			</tr>
			<c:if test="${fn:length(itemList)==0}">
			<tr>
				<td colspan="8">没有项目明细</td>
			</tr>
			</c:if>
			<c:if test="${fn:length(itemList)>0}">
			<c:forEach var="item" items="${itemList}" varStatus="i">
				<tr>
					<td>${item.makeTypeName}</td>
					<td><commonTag:parseEnterToBr source="${item.cooperBillItem.finishedContent}" /></td>
					<td>${item.cooperBillItem.proName}</td>
					<td>
						<commonTag:parseEnterToBr source="${item.cooperBillItem.specification}" />
						<c:if test="${item.cooperBillItem.priceType=='AREA' || item.cooperBillItem.priceType=='LENGTH'}"> x <commonTag:parseBigDecimal source="${item.cooperBillItem.amount}" /></c:if>
					</td>
					<td>
						<c:if test="${item.cooperBillItem.priceType=='AREA'}">平方米</c:if>
						<c:if test="${item.cooperBillItem.priceType=='LENGTH'}">
							<c:if test="${item.cooperBillItem.lengType=='M'}">米</c:if><c:if test="${item.cooperBillItem.lengType=='CM'}">公分</c:if>
						</c:if>
						<c:if test="${item.cooperBillItem.priceType=='AMOUNT'}">${item.cooperBillItem.unit}</c:if>
					</td>
					<td>
						<c:if test="${item.cooperBillItem.priceType=='AREA' || item.cooperBillItem.priceType=='LENGTH'}"><commonTag:parseBigDecimal source="${item.cooperBillItem.squareNum}" /></c:if>
						<c:if test="${item.cooperBillItem.priceType=='AMOUNT'}"><commonTag:parseBigDecimal source="${item.cooperBillItem.amount}" /></c:if>
					</td>
					<td><commonTag:parseEnterToBr source="${item.cooperBillItem.makeRequire}" /></td>
					<td><a href="javascript:showBus('${item.cooperBillItem.bbItemId}');">${item.cooperBillItem.bbCode}</a></td>
				</tr>
			</c:forEach>
			</c:if>
		</table>
		</fieldset>
	 </div>
	 <div class="blank12"></div>
    
     <div class="table-list">
        <fieldset class="det_fieldset ">
     	<legend class="mag10">收货单</legend>
        <table width="98%" align="center">
           	<tr>
			   	<th  width="20%">收货单号</th>
				<th  width="20%">日期</th>
				<th  width="20%">开单人</th>
				<th  width="20%">状态</th>
				<th  width="20%">操作</th>
			</tr>
			<c:if test="${fn:length(gatherList)==0}">
			<tr>
				<td colspan="5">没有收货单</td>
			</tr>
			</c:if>
			<c:if test="${fn:length(gatherList)>0}">
			<c:forEach var="item" items="${gatherList}" varStatus="i">
				<tr>
					<td >${item.billCode}</td>
					<td ><fmt:formatDate value="${item.gatherDate}" pattern="yyyy-MM-dd"/></td>
					<td >${item.createrName}</td>
					<td >
						<c:if test="${item.examined=='N'}">未审核</c:if>
						<c:if test="${item.examined=='Y'}">已审核</c:if>
					</td>
					<td>
						<a href="javascript:doCopy('${item.billCode}');">复制单号</a>
						<c:if test="${currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';GATH_BILL_SEAR;')!=-1}"><a href="javascript:showGatherBill(${item.id});">查看</a></c:if>
					</td>
				</tr>
			</c:forEach>
			</c:if>
		</table>
		</fieldset>
	   </div>
	 <div class="blank12"></div>
	 
     <div class="table-list">
        <fieldset class="det_fieldset ">
     	<legend class="mag10">付款单</legend>
        <table width="98%" align="center">
           	<tr>
			   	<th  width="20%">付款单号</th>
				<th  width="20%">日期</th>
				<th  width="20%">开单人</th>
				<th  width="20%">状态</th>
				<th  width="20%">操作</th>
			</tr>
			<c:if test="${fn:length(payList)==0}">
			<tr>
				<td colspan="5">没有付款单</td>
			</tr>
			</c:if>
			<c:if test="${fn:length(payList)>0}">
			<c:forEach var="item" items="${payList}" varStatus="i">
				<tr>
					<td >${item.billCode}</td>
					<td ><fmt:formatDate value="${item.payDate}" pattern="yyyy-MM-dd"/></td>
					<td >${item.createrName}</td>
					<td >
						<c:if test="${item.examined=='N'}">未审核</c:if>
						<c:if test="${item.examined=='Y'}">已审核</c:if>
					</td>
					<td>
						<a href="javascript:doCopy('${item.billCode}');">复制单号</a>
						<c:if test="${currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';PAY_BILL_SEAR;')!=-1}"><a href="javascript:showPayBill(${item.id});">查看</a></c:if>
					</td>
				</tr>
			</c:forEach>
			</c:if>
		</table>
		</fieldset>
     </div>
     <div class="blank12"></div>
     
     <div class="table-list">
        <fieldset class="det_fieldset ">
     	<legend class="mag10">调帐单</legend>
        <table width="98%" align="center">
           	<tr>
			   	<th  width="20%">调账单号</th>
				<th  width="20%">日期</th>
				<th  width="20%">开单人</th>
				<th  width="20%">状态</th>
				<th  width="20%">操作</th>
			</tr>
			<c:if test="${fn:length(adjustList)==0}">
			<tr>
				<td colspan="5">没有调账单</td>
			</tr>
			</c:if>
			<c:if test="${fn:length(adjustList)>0}">
			<c:forEach var="item" items="${adjustList}" varStatus="i">
				<tr>
					<td >${item.billCode}</td>
					<td ><fmt:formatDate value="${item.adjustDate}" pattern="yyyy-MM-dd"/></td>
					<td >${item.createrName}</td>
					<td >
						<c:if test="${item.examined=='N'}">未审核</c:if>
						<c:if test="${item.examined=='Y'}">已审核</c:if>
					</td>
					<td>
						<a href="javascript:doCopy('${item.billCode}');">复制单号</a>
						<c:if test="${currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';ADJU_BILL_SEAR;')!=-1}"><a href="javascript:showAdjustBill(${item.id});">查看</a></c:if>
					</td>
				</tr>
			</c:forEach>
			</c:if>
		</table>
		</fieldset>
     </div>
    </div>
  </div>
</div>	
</body>
</html>